package com.example.animdemo.rigidanim;

import com.example.animdemo.base.BaseObject;
import com.example.animdemo.base.PhasedObject;

public class RigidObject extends PhasedObject {
	private RigidBody mBody;
	
	private boolean mLoop = true;
	
	public RigidObject(RigidBody body) {
		mBody = body;
	}
	
	@Override
	public void update(float timeDelta, BaseObject parent) {
		if(mLoop && mBody.getTime() == mBody.getTimeLife()) {
			mBody.resetAnim();
		}
		mBody.animate(timeDelta);
		
		super.update(timeDelta, parent);
	}
	
	public void setLoop(boolean loop) {
		mLoop = loop;
	}
	
	public boolean getLoop() {
		return mLoop;
	}
	
	public RigidBody getBody() {
		return mBody;
	}
}
